import unittest
import requests
from  config.readconfig import Read
#实例化调用方法
readcon= Read()

#获取配置信息里的vlog信息
class MyTestCase(unittest.TestCase):
    def test_something(self):
        vlogip=readcon.get_vlog("vlip")
        vltimeout=readcon.get_vlog("timeout")

        #发送请求
        vl={"username":"sang","password":123}
        vh={"Content-Type":"application/x-www-form-urlencoded"}
        r=requests.post(vlogip+"/login",headers=vh,data=vl,timeout=int(vltimeout))
        #print(r.url)                                               #这里也可以写float
        #print(r.json())
        cc=r.json()
        status=cc['status']
        self.assertEqual(status,'success')


if __name__ == '__main__':
    unittest.main()
